package com.beiding.workordersystem.orders.generalorder.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
@TableName("bus_order_process")
public class OrderProcess {

    private static final Map<Integer, String> codeNameMap = new HashMap<>();

    static {

        codeNameMap.put(0, "待受理");
        codeNameMap.put(1, "进行中");
        codeNameMap.put(2, "异常");
        codeNameMap.put(3, "完结");
        codeNameMap.put(4, "过期");
        codeNameMap.put(5, "退单");
    }

    @TableId
    private String id;
    private String orderId;

    private Integer maxTime;

    //比例(暂时不用)
    private Double commissionRate;

    //固定金额
    private Double commissionFee;

    //主管提成
    private Double satrapCommissionFee;

    //工序负责人
    @TableField(strategy = FieldStrategy.IGNORED)
    private String principalId;

    //主管
    @TableField(strategy = FieldStrategy.IGNORED)
    private String satrapId;

    @TableField(exist = false)
    private String satrapName;

    @TableField(exist = false)
    private String principalName;


    //大类
    private String bigType;

    //业务类型
    private String businessType;

    //办理事项
    private String work;

    //业务详情
    private String workDetails;

    private Integer sort;

    //激活状态是在审核流转后激活
    private Boolean active = false;

    //
    //private Boolean current = false;

    private Integer statusCode;

    public void setStatusCode(Integer statusCode) {
        this.statusCode = statusCode;
        this.statusName = codeNameMap.get(statusCode);
    }

    @TableField(exist = false)
    private String statusName;

    private String exception;

    //下一道工序的id
    private String nextProcessId;

    //类型
    private Integer type;

    private Boolean complete = false;

}
